package org.apache.ibatis.reflection.property;

import org.junit.Assert;
import org.junit.Test;

/**
 * 
 * @author wxg
 *
 */
public class PropertyTokenizerMY {

	@Test
	public void test001(){
		PropertyTokenizer pt = new PropertyTokenizer("aa[1].bb[2].cc[1]");
		
		Assert.assertEquals("aa", pt.getName());
		Assert.assertEquals("bb[2].cc[1]", pt.getChildren());
		Assert.assertEquals("aa[1]", pt.getIndexedName());
		Assert.assertEquals("1", pt.getIndex());
		Assert.assertTrue( pt.hasNext() );
		
		Assert.assertEquals("bb", pt.next().getName());
		Assert.assertEquals("cc[1]", pt.next().getChildren());
		Assert.assertEquals("bb[2]", pt.next().getIndexedName());
		Assert.assertEquals("2", pt.next().getIndex());
		Assert.assertTrue( pt.next().hasNext() );
		
	}
}
